<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a href="https://www.baidu.com">百度链接</a>
    <script>
        var a =document.getElementsByTagName('a')[0]
        a.onclick = function(event){
            var e =event||window.event
            alert('nonono')
            zuzhi(e)
        }
        function zuzhi(e){
            if(e.preventDefault){
                    e.preventDefault();
                }else{
                    window.event.returnValue = false;
                }
            }

    </script>
</body>
</html>